<template>
	<view class="notice-list">
		<block v-for="(item, index) in noticeList" :key="index">
			<view class="notice-item">
				<view class="notice-header">
					<view class="title">
						<image src="https://mp.blrwworkshop.com/imgs/news.png" mode=""></image>
						<text class="notice-title">{{ item.title }}</text>
					</view>
					<text class="notice-date">{{ item.createTime }}</text>
				</view>
				<view class="notice-content">
					<!-- <text>{{ item.content }}</text> -->
					<u-parse :content="item.content "></u-parse>
				</view>
				<view class="line"></view>
				<navigator :url="'/pages/homePackage/AnnouncementDetail/AnnouncementDetail?id=' + item.id"
					class="detail-btn">
					<view class="">
						查看详情
					</view>
					<image src="https://mp.blrwworkshop.com/imgs/rightIcon.png" mode=""></image>
				</navigator>
			</view>
		</block>
	</view>
</template>

<script>
	import {
		announcementList
	} from "@/api/api.js"
	export default {
		data() {
			return {
				noticeList: [],
				pageNum: 1,
			}
		},
		onLoad() {
			this.handleGetannouncementList()
		},
		methods: {
			async handleGetannouncementList() {
				let res = await announcementList({
					pageNum: this.pageNum,
					pageSize: 10,
				})
				if (res.code == 200) {
					this.noticeList = [...this.noticeList, ...res.rows]
				}
			},

		}
	}
</script>

<style scoped lang="scss">
	.notice-list {
		width: 750rpx;
		min-height: 100vh;
		background: #F9F9F9;
		padding: 10px;
		box-sizing: border-box;
	}

	.notice-item {
		background-color: #fff;
		margin-bottom: 16px;
		padding: 30rpx 24rpx;
		box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(255, 192, 143, 0.15);
		border-radius: 20rpx;
	}

	.notice-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 5px;

		.title {
			display: flex;
			align-items: center;

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}
	}

	.notice-title {
		width: 300rpx;
		font-size: 28rpx;
		font-weight: bold;
		white-space: nowrap;
		/* 禁止换行 */
		overflow: hidden;
		/* 隐藏超出部分 */
		text-overflow: ellipsis;
		/* 显示省略号 */
	}

	.notice-date {
		font-size: 28rpx;
		color: #999;
	}

	.notice-content {
		font-size: 24rpx;
		color: #333333;
		line-height: 34rpx;
		color: #333;
		margin-top: 24rpx;
		max-height: 200rpx;
		overflow: hidden;
	}

	.line {
		width: 100%;
		height: 1rpx;
		background-color: #F1F1F1;
		margin: 24rpx auto;
	}

	.detail-btn {
		font-weight: 500;
		font-size: 24rpx;
		color: #333333;
		line-height: 34rpx;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;

		image {
			width: 48rpx;
			height: 48rpx;
		}
	}
</style>